package MuleBackend;

import static org.junit.Assert.*;

import org.junit.Assert;
import org.junit.Test;

public class BoardTest {

	@Test
	public void test() {
		Board board= new Board();
		
		/* 	we only have one map, so we are only testing with map "1" at the moment.
		*also, we are only testing whether crystite deposits appear in the pattern expected:
		*
		*    1
		*  1 2 1
		*1 2 3 2 1
		*  1 2 1
		*    1
		*
		*if the deposit is on the edge, the parts which fall off are ignored. Intersecting crystite deposits
		*will only round up to whichever number is higher.
		*
		*the deposit is centered around the 3, or the high point, and the high point is always present.
		*this method tests 6 test cases, aka 6 different deposits to check if they appear in the proper position.
		*/
		try{
			board.createMap(1,new int[]{0,4,2},new int[]{0,2,5});
		}catch(Exception e){
			fail(e.getMessage());
		}
		System.out.println("corner deposit:");
		assertEquals(board.lands[0][0].crystite,3);
		assertEquals(board.lands[0][1].crystite,2);
		assertEquals(board.lands[1][0].crystite,2);
		assertEquals(board.lands[1][1].crystite,1);
		assertEquals(board.lands[2][0].crystite,1);
		assertEquals(board.lands[0][2].crystite,1);
		System.out.println("\nside deposit:");
		assertEquals(board.lands[4][2].crystite,3);
		assertEquals(board.lands[4][1].crystite,2);
		assertEquals(board.lands[4][3].crystite,2);
		assertEquals(board.lands[3][2].crystite,2);
		assertEquals(board.lands[4][0].crystite,1);
		assertEquals(board.lands[4][4].crystite,1);
		assertEquals(board.lands[3][1].crystite,1);
		assertEquals(board.lands[3][3].crystite,1);
		assertEquals(board.lands[2][2].crystite,1);
		System.out.println("/n deposit next to store");
		assertEquals(board.lands[2][5].crystite,3);
		assertEquals(board.lands[2][4].crystite,0);
		assertEquals(board.lands[2][6].crystite,2);
		assertEquals(board.lands[3][5].crystite,2);
		assertEquals(board.lands[1][5].crystite,2);
		assertEquals(board.lands[2][3].crystite,1);
		assertEquals(board.lands[2][7].crystite,1);
		assertEquals(board.lands[3][4].crystite,1);
		assertEquals(board.lands[3][6].crystite,1);
		assertEquals(board.lands[4][5].crystite,1);
		assertEquals(board.lands[1][4].crystite,1);
		assertEquals(board.lands[1][6].crystite,1);
		assertEquals(board.lands[0][5].crystite,1);
		
		try{
			board.createMap(1,new int[]{0,4,2},new int[]{0,2,5});
		}catch(Exception e){
			fail(e.getMessage());
		}
	}

}
